package leetcode.code0893;

import java.util.HashSet;
import java.util.Set;

import leetcode.IDebug;

public class Solution implements IDebug {

	public int numSpecialEquivGroups(String[] words) {
		Set<String> set = new HashSet<>();
		for (String str : words) {
			set.add(this.f(str.toCharArray()));
		}
		return set.size();
	}

	private String f(char[] str) {
		int[] eve = new int[26];
		int[] odd = new int[26];
		for (int i = 0; i < str.length; i++) {
			if ((i & 1) == 0) {
				eve[str[i] - 'a']++;
			} else {
				odd[str[i] - 'a']++;
			}
		}
		StringBuffer ans = new StringBuffer();
		for (int num : eve) {
			ans.append(num).append('-');
		}
		for (int num : odd) {
			ans.append(num).append('-');
		}
		return ans.toString();
	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
